﻿@using CodeCamp.Models.Shared
@model SharedViewModel
@{
    var values = new RouteValueDictionary();
    if (@Model != null)
    {
        values["eventName"] = @Model.EventShortName;
    }
    IDictionary<string, object> attributes = new Dictionary<string, object>();
}

@if (@Model.DefaultEventShortName != @Model.EventShortName)
{
<div class="widget rounded-10">
    <h3>This is:</h3>
    <h3>@Model.EventDisplayName</h3>
    <h3>Switch to:</h3>
    <h3>@Html.ActionLink(@Model.DefaultEventDisplayName, "Index", "Home", new { eventName = @Model.DefaultEventShortName }, null)</h3>
</div>
}

<div class="widget rounded-10">
    <h3>Attendees</h3>
    <ul>
        <li>
    @if (DateTime.Now < @Model.EventStartDate.AddDays(7))
    {
        if (string.IsNullOrWhiteSpace(Model.RegistrationUrl) || (Model.RegistrationUrl == "."))
        {
            <span>Attendee Registration is not yet open.</span>
        }
        else
        {
        <a href="@Model.RegistrationUrl" target="_blank">Register to attend</a>
        }
    }
    else
    {
            <span>Event was on @Model.EventStartDate.ToShortDateString()</span>
    }
        </li>
        @if (!string.IsNullOrWhiteSpace(Model.SchedulePdfUrl))
        {
            <li><a href="@Model.SchedulePdfUrl" target="_blank">Schedule (PDF)</a></li>
        }
    </ul>
</div>

<div class="widget rounded-10">

    <h3>Presenters</h3>

    <ul>
        @if (@Request.IsAuthenticated)
        {
            if (!Model.SiteUserId.HasValue)
            {
                <li>Before proposing a Session...
                    <ul>
                    <li>@Html.ActionLink("Create a site account", "RegisterUser", "Account", @values, @attributes)</li>
                    </ul>
                </li>
            }
            else
            {
                if (Model.PresenterProfileCreationAllowed)
                {
                    <li>Before proposing a Session...
                        <ul>
                        <li>@Html.ActionLink("Create a Profile", "Add", "Presenters", @values, @attributes)</li>
                        </ul>
                    </li>
                }
                else if (Model.UserIsEventPresenter)
                {
                    if (Model.SubmissionsOpen)
                    {
                    <li>@Html.ActionLink("Submit a session", "Add", "Sessions", @values, @attributes)</li>
                    }
                    else if (Model.SubmissionsOpenDate > DateTime.Now)
                    {
                    <li>Session Submissions open @Model.SubmissionsOpenDate.ToShortDateString()</li>
                    }
                    else
                    {
                    <li>(Session submissions are closed.)</li>
                    }
                    <li>@Html.ActionLink("Edit Profile", "Edit", "Presenters", @values, @attributes)</li>
                }
                else if (!Model.SubmissionsOpen && (Model.SubmissionsOpenDate > DateTime.Now))
                {
                    <li>Session Submissions open @Model.SubmissionsOpenDate.ToShortDateString()</li>
                }
                else
                {
                    <li>(Session submissions are closed.)</li>
                }
            }
        }
        else
        {
            if (Model.SubmissionsOpen)
            {
            <li>Propose a session by first...
                <ul>
                    @if (Model.AuthUsesWIF)
                    {
                        <li>@Html.ActionLink("Creating a site account", "Signin", "Account", @values, @attributes)</li>
                    }
                    else
                    {
                        <li>@Html.ActionLink("Creating a presenter login", "Create", "Account", @values, @attributes)</li>
                    }
                    <li>@Html.ActionLink("Signing in", "Signin", "Account", @values, @attributes)</li>
                </ul>
            </li>
            }
            else if (!Model.SubmissionsOpen && (Model.SubmissionsOpenDate > DateTime.Now))
            {
                <li>Session Submissions open @Model.SubmissionsOpenDate.ToShortDateString()</li>
            }
            else
            {
                <li>(Session submissions are closed.)</li>
            }
        }
        @*<li>@Html.ActionLink("Sessions", "List", "Sessions", @values, @attributes)</li>*@
    </ul>

</div>

<div class="widget rounded-10">

    <h3>Sponsors</h3>

    <p>
      Become a sponsor to @Html.Encode(@ViewBag.DisplayName)!
      Please view our <a href="http://ccboston.blob.core.windows.net/ccmisc/BostonCodeCampSponsorship201210c.pdf" target="_blank">sponsorship opportunities</a> (PDF) for complete details.
    </p>

</div>

<div class="widget rounded-10">

    <h3>Individual Contributions</h3>

    <p>@Html.ActionLink("Individual contributions", "Index", "Volunteers", @values, @attributes) of time or in-kind support are welcomed!</p>

</div>